package com.netease.pris.c;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.net.Uri;
import com.netease.pris.provider.ac;
import com.netease.pris.provider.r;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class b
{
  private static String[] a;
  private static final int b = 1;
  private static final int c = 2;
  private static final int d = 3;
  private static final int e = 4;
  private static final int f = 5;
  private static final int g = 6;

  static
  {
    String[] arrayOfString = new String[7];
    arrayOfString[0] = "_id";
    arrayOfString[1] = "name";
    arrayOfString[2] = "desc";
    arrayOfString[3] = "md";
    arrayOfString[4] = "path";
    arrayOfString[5] = "len";
    arrayOfString[6] = "url";
    a = arrayOfString;
  }

  public static String a(Context paramContext, String paramString)
  {
    String str = null;
    if ((paramContext != null) && (paramString != null))
    {
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = r.i;
      String[] arrayOfString1 = new String[1];
      arrayOfString1[0] = "path";
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString;
      Cursor localCursor = localContentResolver.query(localUri, arrayOfString1, "name=?", arrayOfString2, null);
      if (localCursor != null)
      {
        if (localCursor.moveToFirst())
          str = localCursor.getString(0);
        localCursor.close();
      }
    }
    return str;
  }

  public static List a(Context paramContext)
  {
    LinkedList localLinkedList = null;
    if (paramContext != null)
    {
      Cursor localCursor = paramContext.getContentResolver().query(r.i, a, null, null, null);
      if ((localCursor != null) && (localCursor.moveToFirst()))
      {
        localLinkedList = new LinkedList();
        do
        {
          com.netease.pris.atom.b.b localb = new com.netease.pris.atom.b.b();
          localb.a(localCursor.getString(1));
          localb.b(localCursor.getString(2));
          localb.d(localCursor.getString(3));
          localb.e(localCursor.getString(4));
          localb.a(localCursor.getLong(5));
          localb.c(localCursor.getString(6));
          localLinkedList.add(localb);
        }
        while (localCursor.moveToNext());
        localCursor.close();
      }
    }
    return localLinkedList;
  }

  public static void a(Context paramContext, String paramString1, String paramString2)
  {
    if ((paramContext != null) && (paramString1 != null) && (paramString2 != null))
    {
      ContentValues localContentValues = new ContentValues();
      localContentValues.put("path", paramString2);
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = r.i;
      String[] arrayOfString = new String[1];
      arrayOfString[0] = paramString1;
      localContentResolver.update(localUri, localContentValues, "name=?", arrayOfString);
    }
  }

  public static void a(Context paramContext, List paramList)
  {
    SQLiteDatabase localSQLiteDatabase;
    SQLiteStatement localSQLiteStatement;
    if ((paramContext != null) && (paramList != null) && (paramList.size() > 0))
    {
      localSQLiteDatabase = ac.a(paramContext).getWritableDatabase();
      localSQLiteDatabase.beginTransaction();
      localSQLiteStatement = null;
    }
    try
    {
      StringBuilder localStringBuilder = new StringBuilder();
      localStringBuilder.append(" INSERT INTO ");
      localStringBuilder.append("fonts");
      localStringBuilder.append("(");
      localStringBuilder.append("name");
      localStringBuilder.append(",");
      localStringBuilder.append("desc");
      localStringBuilder.append(",");
      localStringBuilder.append("len");
      localStringBuilder.append(",");
      localStringBuilder.append("md");
      localStringBuilder.append(",");
      localStringBuilder.append("url");
      localStringBuilder.append(")");
      localStringBuilder.append(" VALUES(");
      localStringBuilder.append("?,?,?,?,?");
      localStringBuilder.append(");");
      localSQLiteStatement = localSQLiteDatabase.compileStatement(localStringBuilder.toString());
      Iterator localIterator = paramList.iterator();
      while (localIterator.hasNext())
      {
        com.netease.pris.atom.b.b localb = (com.netease.pris.atom.b.b)localIterator.next();
        a(localSQLiteStatement, 1, localb.a());
        a(localSQLiteStatement, 2, localb.b());
        localSQLiteStatement.bindLong(3, localb.e());
        a(localSQLiteStatement, 4, localb.d());
        a(localSQLiteStatement, 5, localb.c());
        localSQLiteStatement.execute();
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      while (true)
      {
        return;
        localSQLiteDatabase.setTransactionSuccessful();
        if (localSQLiteStatement != null)
          localSQLiteStatement.close();
        localSQLiteDatabase.endTransaction();
      }
    }
    finally
    {
      if (localSQLiteStatement != null)
        localSQLiteStatement.close();
      localSQLiteDatabase.endTransaction();
    }
    throw localObject;
  }

  private static void a(SQLiteStatement paramSQLiteStatement, int paramInt, String paramString)
  {
    if (paramString == null)
      paramSQLiteStatement.bindNull(paramInt);
    while (true)
    {
      return;
      paramSQLiteStatement.bindString(paramInt, paramString);
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.c.b
 * JD-Core Version:    0.6.0
 */